package cn.zktr.Personnel.model.service.zhouyongcong;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.zktr.Personnel.common.TimeStamp;
import cn.zktr.Personnel.model.pojos.PerAuditTab;
import cn.zktr.Personnel.model.pojos.PerAuditZd;
import cn.zktr.Personnel.model.pojos.PerPmsDept;
import cn.zktr.Personnel.model.pojos.PerPmsDis;
import cn.zktr.Personnel.model.pojos.PerPmsEmp;
import cn.zktr.Personnel.model.pojos.PerSlySet;
import cn.zktr.Personnel.model.pojos.PerSlySls;
import cn.zktr.Personnel.model.pojos.PerTngPlan;

@Service
@Transactional(rollbackFor=Exception.class)
public class saveAuditService {
	@Autowired
	private findService fs;
	@Autowired
	private boolService bl;
	
	public PerPmsEmp save_emp(String empname,String empcard) {
		PerPmsEmp ppe = new PerPmsEmp();
		ppe.setEmpname(empname);
		ppe.setEmpcard(empcard);
		return ppe;
	}
	
	public PerSlySet save_set(PerSlySet pss_1) {
		PerSlySet pss = new PerSlySet();
		pss.setSetid(pss_1.getSetid());
		pss.setSetname(pss_1.getSetname());
		pss.setPerPmsEmp1(pss_1.getPerPmsEmp1());
		pss.setPerPmsPot(pss_1.getPerPmsPot());
		pss.setPerPmsEmp2(pss_1.getPerPmsEmp2());
		pss.setSettime(pss_1.getSettime());
		pss.setSetrem(pss_1.getSetrem());
		pss.setSetstat(pss_1.getSetstat());
		return pss;
	}
	public PerSlySls save_sls(PerSlySls pss_1) {
		PerSlySls pss = new PerSlySls();
		pss.setSlsid(pss_1.getSlsid());
		pss.setPerSlySet(pss_1.getPerSlySet());
		pss.setSlszt(pss_1.getSlszt());
		pss.setPerPmsEmp1(pss_1.getPerPmsEmp1());
		pss.setPerPmsEmp2(pss_1.getPerPmsEmp2());
		pss.setSlstime(pss_1.getSlstime());
		pss.setSlsrem(pss_1.getSlsrem());
		pss.setSlsstat(pss_1.getSlsstat());
		return pss;
	}
	public PerTngPlan save_plan(PerTngPlan p) {
		PerTngPlan pss = new PerTngPlan();
		pss.setPlanid(p.getPlanid());
		pss.setPlanname(p.getPlanname());
		pss.setPlandd(p.getPlandd());
		pss.setPlants(p.getPlants());
		pss.setPlannind(p.getPlannind());
		pss.setPlanmaxd(p.getPlanmaxd());
		pss.setPlannr(p.getPlannr());
		pss.setPerPmsEmp1(p.getPerPmsEmp1());
		pss.setPerPmsEmp2(p.getPerPmsEmp2());
		pss.setPlanyy(p.getPlanyy());
		pss.setPlanstate(p.getPlanstate());
		return pss;
	}
	
	public PerPmsDis save_Dis(int empid,PerPmsDept ppde,String disyy,String diszt) {
		PerPmsDis ppd = new PerPmsDis();
		ppd.setDisid(bl.bool_Dis()+1);
		ppd.setPerPmsEmp(fs.findEmpid(empid));
		ppd.setPerPmsDept(ppde);
		ppd.setDisyy(disyy);
		ppd.setDistime(new TimeStamp().getNetworkTime());
		ppd.setDiszt(diszt);
		return ppd;
	}
	public PerAuditTab save_Tab(String tabname,int tabid) {
		PerAuditTab pat = new PerAuditTab();
		pat.setTabid(bl.bool_Tab(tabname));
		pat.setTabname(tabname);
		return pat;
	}
	public PerAuditZd save_Zd(String ztname,int ztid,PerAuditTab pat) {
		PerAuditZd paz = new PerAuditZd();
		paz.setPerAuditTab(pat);
		paz.setZtid(ztid);
		paz.setZtname(ztname);
		return paz;
	}
}
